package cn.edu.guet.controller;

import cn.edu.guet.bean.lnc.Users_lnc;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

@Controller
@RequestMapping("iframeTurn")
public class IframeTurn {
    @GetMapping("iframeTurn/toMyPost")
    public String toMyPost(Model model, HttpServletRequest request, String pid){
        String page = request.getParameter("page");
        System.out.println(page);
//        request.setAttribute("page",page+"?pid="+pid);
        System.out.println(page + "?pid=" + pid);
        model.addAttribute("page",page+"?pid="+pid);
        Users_lnc user = (Users_lnc) request.getSession().getAttribute("user");
        if (user==null){
            request.setAttribute("username","登录");
        }else{
            request.setAttribute("username",user.getUsername());
            request.setAttribute("hphoto",user.getHphoto());
        }
        return "forward:/main";
    }
}
